<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="机构">
              <j-select-depart v-model="queryParam.office"/>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="系统名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
              <a-input placeholder="请输入系统名称查询" v-model="queryParam.systemName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="12">
            <a-form-item label="结算截止时间" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
              <j-date v-model="queryParam.thisPayTime" :showTime="true" date-format="YYYY-MM-DD "  ></j-date>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :md="12" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<!--              <a-button type="primary" icon="download" @click="handleExportXls('云资源审核清单')" style="margin-left: 8px">审核清单</a-button>-->
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">详情</a>
        </span>
      </a-table>
    </div>

<!--    <cloud-server-management-model ref="modalForm" @ok="modalFormOk"></cloud-server-management-model>-->
  </a-card>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  // import cloudServerManagementModel from './modules/cloudServerManagementModel'
  import JDate from '@/components/jeecg/JDate.vue'
  import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
  export default {
    name: "realtimeCloudMoneyList",
    mixins:[JeecgListMixin],
    components: {
      JDate,
      // cloudServerManagementModel,
      JSelectDepart
    },
    data () {
      return {
        queryParam:{
          systemName:'',
          office:'',
          thisPayTime:''
        },
          description: '',
        // 表头
        columns: [
          {
            title: '序号',
            align: "center",
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title:'区县',
            align:"center",
            dataIndex: 'sysOrgCodeName',

          },
          {
            title:'单位名称',
            align:"center",
            width: '10%',
            dataIndex: 'officeName',
          },
          {
            title:'系统名称',
            align:"center",
            dataIndex: 'systemName'
          },
          {
            title:'云服务器名称',
            align:"center",
            dataIndex: 'serverName'
          },
          {
            title: '审核配置',
            children: [
              {
                title: 'CPU',
                dataIndex: 'cpu',
                align: "center",
                key: 'cpu',
                // width: 200,
              },
              {
                title: '内存',
                align: "center",
                dataIndex: 'memory',
                key: 'memory',
              },
              {
                title: '审核后云硬盘',
                align: "center",
                dataIndex: 'disk',
                key: 'disk'
              },
            ]
          },
          {
            title:'数据库',
            align:"center",
            width: '8%',
            dataIndex: 'dataBase_dictText'
          },
          {
            title:'开通时间',
            align:"center",
            width: '8%',
            dataIndex: 'openTime'
          },
          {
            title:'上次结算时间',
            align:"center",
            width: '8%',
            dataIndex: 'lastPayTime'
          },
          {
            title:'累计运行时长',
            align:"center",
            dataIndex: 'runningTime',
          },
          {
            title:'未结算在线时长',
            align:"center",
            dataIndex: 'noSetTime',
          },
          {
            title:'年服务费(元)',
            align:"center",
            dataIndex: 'yearMoney',
          },
          {
            title:'未结算金额',
            align:"center",
            dataIndex: 'lastYearMoney',
          },
          // {
          //   title: '操作',
          //   dataIndex: 'action',
          //   align:"center",
          //   scopedSlots: { customRender: 'action' },
          // }
        ],
        url: {
          list: "/jinanCloud/cloudServiceProject/cloudManageList",
          // exportXlsUrl: "/jinanAudit/auditMain/exportXls",
        },
        dictOptions:{
         office:[],
         tos:[],
        } 
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      initDictConfig(){
        // initDictOptions('sys_depart,depart_name,id').then((res) => {
        //   debugger
        //   if (res.success) {
        //     this.$set(this.dictOptions, 'office', res.result)
        //   }
        // })
        initDictOptions('tos').then((res) => {
          if (res.success) {
            this.$set(this.dictOptions, 'tos', res.result)
          }
        })
      }
       
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>